cc.Class({
    extends: cc.Component,

    properties: {
        stateString: [cc.String],
        stateColor: [cc.Color],
        statePosition: [cc.Vec2],
    },
    editor: {
        menu: 'ExtendUI/LabelState',
        requireComponent: cc.Label,
    },

    setState: function(stateIndex) {
        var str = this.stateString[stateIndex];
        var color = this.stateColor[stateIndex];
        var position = this.statePosition[stateIndex];

        if (str) {
            this.getComponent(cc.Label).string = str;
        }
        if (color) {
            this.node.color = color;
        }
        if (position) {
            this.node.position = position;
        }
    }
});